package events

import (
	"time"

	"github.com/google/uuid"
)

// OrderCreatedEvent 订单创建事件
type OrderCreatedEvent struct {
	BaseEvent
	OrderID     uuid.UUID `json:"order_id"`
	UserID      uuid.UUID `json:"user_id"`
	Product     uuid.UUID `json:"product"`
	Quantity    int       `json:"quantity"`
	TotalAmount float64   `json:"total_amount"`
	CreatedAt   time.Time `json:"created_at"`
}

func NewOrderCreatedEvent(orderID uuid.UUID, userID uuid.UUID, product uuid.UUID, quantity int, totalAmount float64) *OrderCreatedEvent {
	return &OrderCreatedEvent{
		BaseEvent:   NewBaseEvent(),
		OrderID:     orderID,
		UserID:      userID,
		Product:     product,
		Quantity:    quantity,
		TotalAmount: totalAmount,
		CreatedAt:   time.Now(),
	}
}

func (e *OrderCreatedEvent) EventName() string {
	return "order.created"
}
